

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>编辑职位表单</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../static/layui/css/layui.css" media="all">
</head>
<body>

<form id="myform" class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
    <!--  职位编码job_id-->
    <div class="layui-form-item">
        <label class="layui-form-label">职位编码：</label>
        <div class="layui-input-inline">
            <input readonly="true" type="text" name="job_id" lay-verify="required" placeholder="请输入用户名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <!--  职位名称job_name-->
    <div class="layui-form-item">
        <label class="layui-form-label">职位名称：</label>
        <div class="layui-input-inline">
            <input type="text" name="job_name" lay-verify="required" placeholder="请输入职位名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <!--  职位分类job_type-->
    <div class="layui-inline">
        <label class="layui-form-label">职位分类</label>
        <div class="layui-input-inline">
            <select name="job_type">
                <option value="">--请选择--</option>
                <option value="管理">管理</option>
                <option value="技术">技术</option>
                <option value="实施">实施</option>
                <option value="测试">测试</option>
                <option value="售前">售前</option>
                <option value="财务">财务</option>
                <option value="行政">行政</option>
            </select>
        </div>
    </div>
    <!--  所属部门dept_name-->
    <div class="layui-form-item">
        <label class="layui-form-label">所属部门：</label>
        <div class="layui-input-inline">
            <select name="dept_name" id="dept_name">
                <option value="">--请选择--</option>
            </select>
        </div>
    </div>
    <!--  职位描述 description-->
    <div class="layui-form-item">
        <label class="layui-form-label">职位描述：</label>
        <div class="layui-input-inline">
            <textarea style="width: 400px" name="description" lay-verify="required" lay-verType="tips" placeholder="" class="layui-textarea"></textarea>
        </div>
    </div>
    <!--  备注 remark-->
    <div class="layui-form-item">
        <label class="layui-form-label">备注：</label>
        <div class="layui-input-inline">
            <textarea style="width: 400px" name="remark" lay-verify="required" lay-verType="tips" placeholder="" class="layui-textarea"></textarea>
        </div>
    </div>
    <!--是否启用 status-->
    <div class="layui-form-item">
        <label class="layui-form-label">是否启用</label>
        <div class="layui-input-block">
            <input type="radio" name="status" value="1" title="是">
            <input type="radio" name="status" value="0" title="否" checked>
        </div>
    </div>
    <!--确认提交-->
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-back-submit" value="确认">
    </div>
</form>

<!--引入本地layui.js-->
<script src="../../../static/layui/layui.js"></script>
<script src="../../../static/js/jquery-3.6.0.min.js"></script>
<!--js-->
<script type="text/javascript">

    //获取标签对象，把数据写入标签体中间
    // document.getElementById("user").val(user.user_username) ;

    layui.config({
        base: '../../../static/layui/layuiadmin/' //静态资源所在路径js
    }).extend({
        index: 'lib/index' //主入口模块
    }).use('index');

</script>
<!--<script>-->
<!--  layui.use('laydate', function() {-->
<!--    var laydate = layui.laydate;-->
<!--    //常规用法-->
<!--    laydate.render({-->
<!--      elem: '#createtime',// input里时间的Id-->
<!--      value: new Date(),-->
<!--      done: function (value, date) {-->
<!--      }-->

<!--    });-->

<!--  });-->
<!--</script>-->
<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
<script>
    layui.use(['form', 'layedit', 'laydate','jquery'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;


        $(document).ready(function(){
            console.log("-------------")
            var name = sessionStorage.getItem("dept_name");
            console.log("------",name)
            //通过Ajax异步请求-下拉列表选项
            $.ajax({
                url:"/system/selectAllDeptname",
                type:"post",
                data:{},
                dataType:"json",
                success:function (res){
                    console.log("res.data------")
                    console.log(res.data)
                    if(res.code==200){

                        let selectElement=document.getElementById("dept_name");
                        let  options = res.data;
                        for(let i=0;i<res.data.length;i++){
                            let optionElement = document.createElement("option");
                            optionElement.text=res.data[i].dept_name;
                            optionElement.value=res.data[i].dept_name;
                            selectElement.add(optionElement);

                        }
                        console.log(selectElement);
                        selectElement.selectedIndex=1;
                        form.render();

                    }else{

                    }

                },error:function (res){

                }
            })
        })
    });
</script>

</body>
</html>


</body>
</html>